import request from '@/config/axios'

// 商品分类 VO
export interface CommodityCategoryVO {
  id: number // 主键
  categoryName: string // 分类名称
  categoryCode: string // 分类编码
  categoryLevel: string // 分类层级
  parentId: number // 父级主键
  remark: string // 备注
  disabled: boolean // 启停状态
}

// 商品分类 API
export const CommodityCategoryApi = {
  // 查询商品分类分页
  getCommodityCategoryPage: async (params: any) => {
    return await request.get({ url: `/mdm/commodity-category/page`, params })
  },

  // 查询商品分类详情
  getCommodityCategory: async (id: number) => {
    return await request.get({ url: `/mdm/commodity-category/get?id=` + id })
  },

  // 新增商品分类
  createCommodityCategory: async (data: CommodityCategoryVO) => {
    return await request.post({ url: `/mdm/commodity-category/create`, data })
  },

  // 修改商品分类
  updateCommodityCategory: async (data: CommodityCategoryVO) => {
    return await request.put({ url: `/mdm/commodity-category/update`, data })
  },

  // 删除商品分类
  deleteCommodityCategory: async (id: number) => {
    return await request.delete({ url: `/mdm/commodity-category/delete?id=` + id })
  },

  // 导出商品分类 Excel
  exportCommodityCategory: async (params) => {
    return await request.download({ url: `/mdm/commodity-category/export-excel`, params })
  },
}